<template>
	<div>
		<a-spin tip="登陆中..." :spinning="loading" style="position: absolute;top: 50%;">
		</a-spin>
		<div class="box" v-if="noPermission">
			<img src="../../assets/icon_noprm1.png" class="">
			<div class="nodata">
				{{tipMessage}}
			</div>
		</div>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				corpid: this.$route.query.corpid,
				code: '',
				res: '',
				loading: false,
				noPermission: false,
				tipMessage: '暂无权限'
			}
		},

		created() {
			//判断是否钉钉容器里打开页面
			// console.log(this.$dd.env.platform);
			// console.log(this.$route.query);
			this.loading = true
			var _that = this;
			//正式环境请求
			// this.$dd.ready(() => {
			// 	this.$dd.runtime.permission.requestAuthCode({
			// 		corpId: _that.corpid, // 企业id
			// 		onSuccess: function(info) {
			// 			_that.code = info.code; // 通过该免登授权码可以获取用户身份
			// 			// console.log(_that.code + '：that.code');
			// 			axios.post('/sys/get_login', {
			// 				corpid: _that.corpid,
			// 				code: _that.code,
			// 			}).then(res => {
			// 				// console.log(res)
			// 				if (res.status == 200) {
			// 					if (res.data.ret == 200) {
			// 						_that.$store.commit('login', res.data.data.user_info);
			// 						_that.$router.push({
			// 							name: 'index'
			// 						});
			// 						_that.$message.info('登录成功');
			// 					} else {
			// 						// console.log(1);
			// 						_that.tipMessage = res.data.msg;
			// 						_that.noPermission = true;
			// 						_that.loading = false;
			// 					}
			// 				}
			// 				_that.loading = false;
			// 			}).catch(res => {
			// 				console.log(res);
			// 			});
			// 		},
			// 		onFail: function(err) {
			// 			_that.$message.error(err.errorMessage);
			// 		}
			// 	});
			// });


			// //测试环境
			sessionStorage.setItem('corpid', JSON.stringify('ding25f0528573a166b6f5bf40eda33b7ba0'))
			_that.$router.push({name:'index'})
		},
		methods: {},
	}
</script>

<style scoped="scoped">
	.box {
		padding-top: 10%;
		text-align: center;
	}

	.nodata {
		font-size: 20px;
		color: #9c9c9c;
	}
</style>
